From 068d3826896590dd7ff6e41bee88f07e1416afc9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 16 Mar 2016 16:49:21 -0400 Subject: [PATCH] dnd: Hide the drag window when we're done We were just relying on the drag context finalize() to destroy the window. But with garbage-collected bindings, that might not happen as soon as we like, so explicitly hide the window when the drag ends successfully. https://bugzilla.gnome.org/show_bug.cgi?id=763659 --- gdk/wayland/gdkdnd-wayland.c | 14 ++++++++++++++ gdk/x11/gdkdnd-x11.c | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c index 2a2bad51e6..069828d1af 100644 --- a/gdk/wayland/gdkdnd-wayland.c +++ b/gdk/wayland/gdkdnd-wayland.c @@ -445,6 +445,19 @@ gdk_wayland_drag_context_cancel (GdkDragContext *context, gdk_drag_context_set_cursor (context, NULL); } +static void +gdk_wayland_drag_context_drop_done (GdkDragContext *context, + gboolean success) +{ + GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context); + + if (success) + { + if (context_wayland->dnd_window) + gdk_window_hide (context_wayland->dnd_window); + } +} + static void gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass) { @@ -464,6 +477,7 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass) context_class->get_selection = gdk_wayland_drag_context_get_selection; context_class->get_drag_window = gdk_wayland_drag_context_get_drag_window; context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot; + context_class->drop_done = gdk_wayland_drag_context_drop_done; context_class->manage_dnd = gdk_wayland_drag_context_manage_dnd; context_class->set_cursor = gdk_wayland_drag_context_set_cursor; context_class->action_changed = gdk_wayland_drag_context_action_changed; diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index eceb8e9b55..c2a69193d2 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -2616,7 +2616,10 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context, cairo_t *cr; if (success) - return; + { + gdk_window_hide (x11_context->drag_window); + return; + } win_surface = _gdk_window_ref_cairo_surface (x11_context->drag_window); surface = gdk_window_create_similar_surface (x11_context->drag_window, -- 2.30.2